package com.kuangqi.paymentdemo.task;

import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.kuangqi.paymentdemo.entity.OrderInfo;
import com.kuangqi.paymentdemo.service.OrderInfoService;
import com.kuangqi.paymentdemo.service.WeChatpayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Slf4j
public class WxPayTask {
    @Autowired
    private OrderInfoService orderInfoService;
    @Autowired
    private WeChatpayService weChatpayService;


//    @Scheduled(cron = "0/30 * * * * ?")
    public void orderConfirm() {
        List<OrderInfo> orderInfoList = orderInfoService.getNoPayOrderInfo(Integer.valueOf(5));

        for (OrderInfo orderInfo : orderInfoList) {
            String orderNo = orderInfo.getOrderNo();
            log.warn("查询超时订单订单====>[{}]" + orderNo);
            weChatpayService.checkOrderStatus(orderNo);
        }
    }


}
